package com.dkts.oil.util;

import java.util.UUID;

import cn.hutool.core.codec.Base64;

public class SecurityUtils {

    /**
     * 获得32位UUID
     *
     * @return
     */
    public static String getUUID() {
        return UUID.randomUUID().toString().replace("-", "").toUpperCase();
    }

    /**
     * MD5解密
     * 
     * @param inStr
     * @return
     */
    public static String convertMD5(String inStr) {

        String rst = Base64.encode(inStr.getBytes());
        return rst;
    }

    /**
     * MD5解密
     * 
     * @param inStr
     * @return
     */
    public static String deConvertMD5(String inStr) {
        try {
            byte[] rst = Base64.decode(inStr);
            return new String(rst);
        } catch (Exception ex) {
            return inStr;
        }
    }

}
